/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package personadultbaby;

/**
 *
 * @author Ngocvan
 */
public class CommunityApplication implements IMotionListener {
    private String name;
    /**
     *
     * @param eventSource
     */
    @Override
    public void handleMove(Adult eventSource){
        System.out.println("The mover: " + eventSource.toString()+ " on " + this.name);
    }

    public CommunityApplication(String name) {
        this.name = name;
    }
    
    public static void main(String[] args){
        CommunityApplication comEarth = new CommunityApplication("Earth");
        CommunityApplication comMoon = new CommunityApplication("Moon");
        Adult lincol = new Adult("lincol");
        Adult amstrong = new Adult("amstrong");
        amstrong.addMotionListener(comMoon);
        lincol.addMotionListener(comEarth);
        amstrong.move();
        lincol.move();
    }
}
